<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
<head th:replace="common/layout :: common_header(~{::title},~{::link})">
    <title>新建账号</title>
</head>
<body>
<div class="main-container">
    <div class="main-content-inner">
        <div class="page-content">
            <div class="row">
                <form class="form-horizontal" role="form" id="clientAddForm" method="post" th:action="@{/sys/client/saveAccount}" >
                    <input type="hidden" name="clientno" th:value="${clientno}">
                    <div class="form-group">
                        <label class="col-sm-2 control-label" for="clientnickaccount">账号</label>
                        <div class="col-sm-4">
                            <input class="form-control" id="clientnickaccount" name="clientnickaccount" type="text" placeholder="请输入账号" required/>
                        </div>
                        <label class="col-sm-2 control-label" for="clientnickname">昵称</label>
                        <div class="col-sm-4">
                            <input class="form-control" id="clientnickname" name="clientnickname" type="text" placeholder="请输入昵称" required/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label" for="clientnick">聊天软件</label>
                        <div class="col-sm-4">
                            <select class="form-control" id="clientnick"  name="clientnick" >
                                <option value="陌陌">陌陌</option>
                                <option value="微信">微信</option>
                                <option value="QQ">QQ</option>
                                <option value="探探">探探</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group"></div>
                    <div class="form-group"></div>
                    <div class="form-group"></div>



                    <div class="clearfix ">
                        <div class="center">
                            <button class="btn btn-info" type="submit" id="submitBtn">
                                <i class="ace-icon fa fa-check bigger-110"></i>
                                保存
                            </button>

                            &nbsp; &nbsp; &nbsp;
                            <button class="btn" type="button" id="closeWin">
                                <i class="ace-icon fa fa-del bigger-110"></i>
                                关闭
                            </button>
                        </div>
                    </div>
                </form>
            </div>
            <!-- /.col -->
        </div>

    </div>
    <!-- end main container -->
</div>

<div th:replace="common/commonJS"></div>
<script type="text/javascript">
    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
    //关闭iframe
    $('#closeWin').click(function(){
        top.layer.close(index);
    });

    $().ready(function() {
        $("#clientAddForm").validate({
            submitHandler: function(form) {
                //验证通过后 的js代码写在这里

                $(form).ajaxSubmit({
                    dataType:"json",
                    success:function( data ){
                        if(data==1){
                            top.layer.alert('保存成功')
                            top.layer.close(index);
                            if(top.getActiveTab()[0]){
                                top.getActiveTab()[0].contentWindow.search();
                            }
                        }else{
                            top.layer.alert('保存失败')
                        }
                    },
                    error:function(xhr, status, error){
                        top.layer.alert('操作失败');
                    }
                });

            }
        });
    });
</script>
</body>
</html>